package org.shj.pattern.mediator

import scala.collection.mutable.ListBuffer

abstract class Mediator {
  def sendMessage(msg: String, to: String)
}

class Union extends Mediator{
  val colleagues = ListBuffer[Country]()
  
  def addColleague(country: Country){
    colleagues += country
  }
  
  def sendMessage(msg: String, to: String){
    for(country <- colleagues if to == country.name){
      country.getMessage(msg);
    }
  }
}